package com.heima.test4j;

import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class Application {
    public static void main(String[] args) throws TesseractException {
        ITesseract tesseract = new Tesseract();
        //设置字体库路径
        tesseract.setDatapath("D:\\BaiduNetdiskDownload\\tessdata");
        //设置语言
        tesseract.setLanguage("chi_sim");
        //识别图片
        File file = new File("C:\\Users\\Administrator\\Desktop\\296bd3546f33dd74e02f46f0ee54123.jpg");
        String doOCR = tesseract.doOCR(file);
        System.out.println(doOCR);
    }
}
